package com.woniuxy.handler;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.woniuxy.pojo.Member;
import com.woniuxy.service.MemberService;

import lombok.Data;

@Controller
@RequestMapping("/member")
@ResponseBody
@Data
public class MemberHandler {
	@Resource
	private MemberService memberService;
	
	@RequestMapping("/message")
	public List<Member> findMember(String message){
		return memberService.findMember(message);
	}
	
	@RequestMapping("/all")
	public List<Member> getAll(){
		return memberService.getAll();
	}
	@RequestMapping("/add")
	public String addMember(Member member){
		if(memberService.addMember(member)>0){
			return "添加成功";
		}else{
			return "添加失败";
		}
	}
	@RequestMapping("/update")
	public String updateMember(Member member){
		if(memberService.updateMember(member)>0){
			return "修改成功";
		}else{
			return "修改失败";
		}
	}
	@RequestMapping("/del")
	public String delMember(String mnumber){
		if(memberService.delMember(mnumber)>0){
			return "删除成功";
		}else{
			return "删除失败";
		}
	}
}
